{include file="public/layout"/}
<body class="laytp-container">
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-card layui-col-md12">
                    <div class="layui-card-header">
                        <div class="layui-card-header">
                            <div class="layui-tab layui-tab-brief">
                                <ul class="layui-tab-title">
                                    {foreach $group_list as $group}
                                    <li {if $inc_type==$group['inc_type']}class="layui-this"{/if} onclick="location.href='{$group['url']}'">{$group.name}</li>
                                    {/foreach}
                                </ul>

                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body" pad15>
                        <div class="layui-form" lay-filter="">
                            <div class="layui-tab layui-tab-brief" lay-filter="mytab">
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">平台名称：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="store_name" class="layui-input"
                                                       value="{$config.store_name}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">网站标题，便于SEO
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">网站标题：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="store_title" class="layui-input"
                                                       value="{$config.store_title}">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">网站描述：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="store_desc" class="layui-input"
                                                       value="{$config.store_desc}">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">平台LOGO：</label>
                                            <input type="hidden" name="store_logo" id="logo" class="layui-input"
                                                   value="{$config.store_logo}">
                                            <button style="float:left;" type="button" class="layui-btn layui-btn-primary"
                                                    onclick="uploader(this)" upload-input="logo" upload-preview="logoPreview">
                                                上传图片
                                            </button>
                                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">
                                                建议尺寸：200×200像素
                                            </div>
                                            <div id="logoPreview"
                                                 style="float:left;padding-top:10px;margin-left:160px;clear: both;">
                                                <div class="layui-imgbox" style="width:100px;">
                                                    <div class="layui-imgbox-img"><img src="{$config.store_logo}"/></div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">客服电话：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="kf_phone" class="layui-input"
                                                       value="{$config.kf_phone}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">主色调：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="color1" value="{$config['color1']}"
                                                       class="layui-input">
                                            </div>
                                            <div class="_colorpicker" style="float:left"></div>
                                            <div class="layui-form-mid layui-word-aux">商城主色调，如：#FD4A46</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">辅色调：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="color2" value="{$config['color2']}"
                                                       class="layui-input">
                                            </div>
                                            <div class="_colorpicker" style="float:left"></div>
                                            <div class="layui-form-mid layui-word-aux">商城辅色调，如：#7E71F6</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">版权信息：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="copy_right" class="layui-input"
                                                       value="{$config.copy_right}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">版权链接：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="copy_right_link" class="layui-input"
                                                       value="{$config.copy_right_link}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">网站状态：</label>
                                            <div class="layui-input-inline" style="width:300px">
                                                <input type="radio" name="sys_close" title="开启" value="0"
                                                {if !$config['sys_close']==1}checked{/if}
                                                />
                                                <input type="radio" name="sys_close" title="关闭" value="1"
                                                {if $config['sys_close']}checked{/if}
                                                />
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">关闭说明：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="sys_close_memo" class="layui-input"
                                                       value="{$config.sys_close_memo}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">腾讯地图Key：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="qq_map_key" class="layui-input"
                                                       value="{$config.qq_map_key}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">腾讯开放平台->应用管理 获取</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label"  style="width:130px">高德地图key：</label>
                                            <div class="layui-input-inline" style="width:300px">
                                                <input type="text" name="map_key_amap" class="layui-input" value="{$config.map_key_amap}"/>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">必须，[高德开放平台控制台 - 应用管理 - 我的应用]中创建应用，添加 key，服务平台选择 Web端(JS API) <a href="https://lbs.amap.com/api/javascript-api-v2/prerequisites" target="_blank">使用帮助</a></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label"  style="width:130px">高德地图安全密钥：</label>
                                            <div class="layui-input-inline" style="width:300px">
                                                <input type="text" name="js_code_amap" class="layui-input" value="{$config.js_code_amap}"/>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">必须，高德自2021年12月02日升级，升级之后所申请的 key 必须配备安全密钥(jscode)一起使用，升级之前申请的key不需要配置安全密钥(jscode)<a target="_blank" href="https://lbs.amap.com/api/javascript-api/guide/abc/prepare">使用帮助</a></div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">附件存储类型：</label>
                                            <div class="layui-input-inline" style="width:300px">
                                                <input type="radio" name="oss_type" title="本地存储" value="0"
                                                {if $config['oss_type'] == 0}checked{/if}
                                                />
                                                <input type="radio" name="oss_type" title="腾讯云" value="tengxun"
                                                {if $config['oss_type'] == 'tengxun'}checked{/if}
                                                />
                                                <input type="radio" name="oss_type" title="阿里云" value="ali"
                                                {if $config['oss_type']=='ali'}checked{/if}
                                                />
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">快递100授权key：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="kuaidi100_key" class="layui-input"
                                                       value="{$config.kuaidi100_key}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"><a target="_blank" href="https://api.kuaidi100.com/manager/v2/myinfo/enterprise">点击获取</a> 获取</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">快递100公司编号：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="kuaidi100_customer" class="layui-input"
                                                       value="{$config.kuaidi100_customer}">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"><a target="_blank" href="https://api.kuaidi100.com/manager/v2/myinfo/enterprise">点击获取</a> 获取</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="width:130px">登录页背景：</label>
                                            <input type="hidden" name="login_bg" id="login_bg" class="layui-input"
                                                   value="{$config.login_bg}">
                                            <button style="float:left;" type="button" class="layui-btn layui-btn-primary"
                                                    onclick="uploader(this)" upload-input="login_bg" upload-preview="login_bgPreview">
                                                上传图片
                                            </button>
                                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">

                                            </div>
                                            <div id="login_bgPreview"
                                                 style="float:left;padding-top:10px;margin-left:160px;clear: both;">
                                                <div class="layui-imgbox" style="width:100px;">
                                                    <div class="layui-imgbox-img"><img src="{$config.login_bg}"/></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block" style="margin-left:175px;">
                                    <button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(function () {
        layui.laydate.render({
            elem: '#start_hours',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.laydate.render({
            elem: '#end_hours',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.laydate.render({
            elem: '#start_hours1',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.laydate.render({
            elem: '#end_hours1',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.form.on('submit(formsubmit)', function (obj) {
            var field = obj.field
            //哪个选项卡 用于刷新后保持
            var tabindex = 0;
            $('.layui-tab-title>li').each(function (i, v) {
                if ($(this).hasClass('layui-this')) {
                    tabindex = i;
                    console.log(i)
                    return false;
                }
            })
            field.tabindex = tabindex;
            field.inc_type = 'basic';
            var index = layer.load();
            $.post('{:url("handle")}', field, function (data) {
                layer.close(index);
                dialog(data.msg, data.status, data.url);
            })
        })

    })

    function choosezuobiao() {
        var address = $("input[name='info[address]']").val();
        var longitude = $("input[name='info[longitude]']").val();
        var latitude = $("input[name='info[latitude]']").val();
        var choosezblayer = layer.open({
            type: 2,
            shadeClose: true,
            area: ['800px', '560px'],
            'title': '选择坐标',
            content: "{:url('DesignerPage/choosezuobiao')}&address=" + (address ? address : "") + "&jd=" + (longitude ? longitude : "") + "&wd=" + (latitude ? latitude : ""),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var longitude = layero.find('iframe').contents().find('#mapjd').val();
                var latitude = layero.find('iframe').contents().find('#mapwd').val();
                $("input[name='info[longitude]']").val(longitude);
                $("input[name='info[latitude]']").val(latitude);
                layer.close(choosezblayer);
            }
        });
    }
</script>
</body>
</html>